package castle.defense.project;

import android.content.Context;
import android.view.SurfaceHolder;
import android.view.SurfaceView;

/**
 * Basic View object to hold the menu screen
 * @author Daniel Wasserman
 *
 */
public class HighscoreView extends SurfaceView implements SurfaceHolder.Callback {
	HighscoreThread thread;
	public HighscoreView(Context context) {
		super(context);
		SurfaceHolder s = this.getHolder();
		s.addCallback(this);
		this.setFocusable(true);
		thread = new HighscoreThread();
	}
	
	public void surfaceChanged(SurfaceHolder s, int format, int width, int height) {
		PE.setBounds(s.getSurfaceFrame().width(), s.getSurfaceFrame().height());
		thread.setSurfaceHolder(s);
	}

	public void surfaceCreated(SurfaceHolder s) {
		PE.setBounds(s.getSurfaceFrame().width(), s.getSurfaceFrame().height());
		GraphicsEngine.initialize();
		thread.setSurfaceHolder(s);
		thread.start();
	}

	public void surfaceDestroyed(SurfaceHolder s) {
		thread.setRunning(false);
	}
	
	public void stop() {
		thread.setRunning(false);
	}
}
